package com.hexus.eve.entities;

import java.util.Locale;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.hexus.eve.utils.TranslationUtils;


@Entity
@Table(name="invGroups")
public class Group extends EveEntity{
	private static final String DB_TABLE_NAME = "dbo.invGroups";
	private static final String NAME_COLUMN = "groupName";
	private static final String DESCRIPTION_COLUMN = "description";
	
	@Id	
	@Column(name="groupID")
	private Integer id;
	@Column(name="groupName")
	private String name;
	
	@ManyToOne
	@JoinColumn(name="categoryID")
	private Category category;
	
	@ManyToOne
	@JoinColumn(name="iconID")
	private Icon icon;
	
    private String description;
    
    private Boolean useBasePrice;
    private Boolean allowManufacture;
    private Boolean allowRecycler;
    private Boolean anchored;
    private Boolean anchorable;
    private Boolean fittableNonSingleton;
    private Boolean published;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getUseBasePrice() {
		return useBasePrice;
	}
	public void setUseBasePrice(Boolean useBasePrice) {
		this.useBasePrice = useBasePrice;
	}
	public Boolean getAllowManufacture() {
		return allowManufacture;
	}
	public void setAllowManufacture(Boolean allowManufacture) {
		this.allowManufacture = allowManufacture;
	}
	public Boolean getAllowRecycler() {
		return allowRecycler;
	}
	public void setAllowRecycler(Boolean allowRecycler) {
		this.allowRecycler = allowRecycler;
	}
	public Boolean getAnchored() {
		return anchored;
	}
	public void setAnchored(Boolean anchored) {
		this.anchored = anchored;
	}
	public Boolean getAnchorable() {
		return anchorable;
	}
	public void setAnchorable(Boolean anchorable) {
		this.anchorable = anchorable;
	}
	public Boolean getFittableNonSingleton() {
		return fittableNonSingleton;
	}
	public void setFittableNonSingleton(Boolean fittableNonSingleton) {
		this.fittableNonSingleton = fittableNonSingleton;
	}
	public Boolean getPublished() {
		return published;
	}
	public void setPublished(Boolean published) {
		this.published = published;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	
	public Icon getIcon() {
		return icon;
	}
	public void setIcon(Icon icon) {
		this.icon = icon;
	}
	@Override
	public void translate(Map<String, String> translationValues, Locale locale) {
		if(translationValues.containsKey(NAME_COLUMN)) {
			setName(translationValues.get(NAME_COLUMN));
		}	
		if(translationValues.containsKey(DESCRIPTION_COLUMN)) {
			setDescription(translationValues.get(DESCRIPTION_COLUMN));
		}
		TranslationUtils.getInstance().translate(category, locale);
	}
	
	@Override
	public String getTableName() {
		return DB_TABLE_NAME;
	}  
    
}
